package com.imooc.scala

import org.apache.spark.{SparkConf, SparkContext}

object HelloWorld {
  def main(args: Array[String]): Unit = {
    println("hello world")

    println(add(2, 4))
    println(three())
    println(three)
    print(satName())
    print(satName("bbb"))
    //    val conf = new SparkConf().setAppName("test").setMaster("local[*]")
    //    val sparkContext = new SparkContext(conf)
    //    sparkContext.setLogLevel("ERROR")
    //    val rdd1 = sparkContext.parallelize(Array(1, 2, 3, 5))
    //    rdd1.foreach(println)

    for (i <- Range(1, 10)) {
      println(i)
    }
  }

  def add(x: Int, y: Int): Int = {
    x + y
  }

  def three() = 1 + 2

  def sayHello(): Unit = {
    println("hello world")
  }

  def satName(name: String = "aaa"): Unit = {
    print(name)
  }
}
